home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3760 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1018 b 

  1. Path: news.uh.edu!usenet
  2. From: Sensarn <txs53132@bayou.uh.edu>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: help with vga
  5. Date: 25 Jan 1996 22:47:07 GMT
  6. Organization: AEtna Insurance Agency
  7. Message-ID: <4e919b$i36@masala.cc.uh.edu>
  8. References: <4e8v31$p9d@ixnews7.ix.netcom.com>
  9. NNTP-Posting-Host: sip-14308.public-dialups.uh.edu
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1 (Windows; U; 16bit)
  14.  
  15. Here's how to switch to mode 13h (good for simple graphics):
  16.  
  17. //AX=SCREEN MODE (IN THIS CASE -- 0X13)
  18. //INT 0X10
  19.  
  20. asm {
  21.     mov ax,0x13
  22.     int 0x10
  23. }
  24.  
  25. Okay.  Now here is a function to plot a pixel:
  26.  
  27. //You need a pointer for access to the video buffer
  28. unsigned char far *video_buffer=(unsigned char far *)0xA0000000;
  29.  
  30. void pixel(int x,int y,int color)
  31. {
  32.     //Uses shifting for speed (Andre LaMothe taught me that)
  33.     //y<<8 = y * 256 and y<<6 = y * 64 -- 256 + 64 = 320
  34.     video_buffer[(y<<8)+(y<<6)+x]=color;
  35. }
  36.  
  37.  
  38. Steven Sensarn - txs53132@bayou.uh.edu
  39.  
  40.  
  41.